/**
 * Created with IntelliJ IDEA.
 * User: liulinhui
 * Date: 18-10-9
 * Time: 上午11:56
 * Description: hash
 */
function getSha256Hash(stringToSign, format) {
  if (!format) {
    stringToSign = global.naclInstance.encode_utf8(stringToSign);
  } else if (format === 'utf8') {
    stringToSign = global.naclInstance.encode_utf8(stringToSign);
  } else if (format === 'hex') {
    stringToSign = global.naclInstance.from_hex(stringToSign);
  }

  return global.naclInstance.crypto_hash_sha256(stringToSign);
}

export default {
  getSha256Hash: getSha256Hash
};
